package il.ac.braude.sona.gui;

import java.awt.Dimension;
import java.awt.Toolkit;

import javax.swing.JFrame;
/**
 * The SONAFrame is a JFrame that we use in our application and implements methods for showing frame
 *  
 * @author Ofek Ron
 * @author Avihay Avitan
 * @author Nitzan Inbar
 * @author Sasha Rozenthal
 */
@SuppressWarnings("serial")
public class SONAFrame extends JFrame {

	/**
	 * Constructs the SONAFrame.
	 * (Empty)
	 */
	public SONAFrame() {
	    }
	/**
	 * pack the fram and set window location at middle of screen, finnaly set visibility true
	 */
	public void showFrame() {	
		pack();
		Dimension dim = Toolkit.getDefaultToolkit().getScreenSize();
		setLocation(dim.width/2 - getWidth()/2, dim.height/2 - getHeight()/2);
		setVisible(true);


	}
	/**
	 * pack the fram and set window location at middle of screen,
	 * set window size with fixed params and 
	 * finnaly set visibility true
	 * 
	 * @param height - the window height size
	 * @param width - the window width size
	 */
	public void showFrame(int height,int width) {		
		Dimension dim = Toolkit.getDefaultToolkit().getScreenSize();
		pack();
		dim.height=Math.max(height, getPreferredSize().height);
		dim.width=Math.max(width, getPreferredSize().width);
		setPreferredSize(dim);
		pack();
		dim = Toolkit.getDefaultToolkit().getScreenSize();
		setLocation(dim.width/2 - getWidth()/2, dim.height/2 - getHeight()/2);
		setVisible(true);
		setResizable(false);


	}
	
}
